#pragma once

#include <Scene.h>
#include <Sprite.h>

#include <Camera.h>
#include <InputManager.h>
#include "dxBlur.h"


class TestScene : public VKScene , public RBInputHandler
{
public:
	TestScene(void);
	~TestScene(void);

	long InitScene(LPDIRECT3DDEVICE9 pDevice)
	{
		m_pDevice = pDevice;

		sprite.Load(pDevice , "start.tga" , &FRECT(-5,5,5,-5));
		AddObject(&sprite);

		sprite2.Load(pDevice , "test.tga" , &FRECT(0,1,1,0));
		AddObject(&sprite2);

		sprite3.Load(pDevice, "tex.jpg" , &FRECT(2,1,3,0));
		AddObject(&sprite3);

		sprite4.Load(pDevice, "tex.jpg" , &FRECT(-2,1,-1,0));
		AddObject(&sprite4);

		sprite5.Load(pDevice, "tex.jpg" , &FRECT(0,3,1,2));
		AddObject(&sprite5);

		m_Camera.Eye(0,0,-10);
		m_Camera.LookAt(0,0,10);
		m_Camera.Upvec(0,1,0);

		m_Blur.m_pd3dDevice = pDevice;
		m_Blur.BlurInit();

		return TRUE;
	}

	long HandleInput(RBInputSystem* pISys)
	{
		if(pISys->Is_Down(VK_LEFT)) m_Camera.EyeMove(-0.1 ,0,0);
		else if(pISys->Is_Down(VK_RIGHT)) m_Camera.EyeMove(0.1 , 0,0);
		else if(pISys->Is_Down(VK_UP)) m_Camera.EyeMove(0 ,0.1,0);
		else if(pISys->Is_Down(VK_DOWN)) m_Camera.EyeMove(0, -0.1,0);

		return 1;
	}

	void RenderAll()
	{
		m_Camera.Update(m_pDevice);

		for_each(m_ObjList.begin() , m_ObjList.end() , std::mem_fun(VKObject::Render));
	}

	RBCamera m_Camera;

	LPDIRECT3DDEVICE9 m_pDevice;

	VKSprite sprite;
	VKSprite2 sprite2;
	VKSprite3 sprite3;
	VKSprite4 sprite4;
	VKSprite5 sprite5;
	dxBlur m_Blur;
};
